<!DOCTYPE html>
<html>

<head>

    {include file="Public/header"}
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="__STATIC__/layout/css/plugins/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/layout/css/demo/webuploader-demo.css">
    <style>
        .radio-inline input[type=radio] {
            margin-top: 0px
        }
        .colorRed{color:red;}
        .bqName{padding: 2px 4px;border-radius: 6px;background: #f66;cursor: pointer;}
    </style>

</head>

<body class="white-bg" style="color:#333;padding:3px;">
 <div class="page-heade">
       <h2 class="title_color text-center">修改网点基本信息</h2>
    </div>
<div class="white-bg setRemindPeopleK" style="margin:10px">
    <form action="" class="form-inline" id="add" method="post">
        <table class="table table-bordered">
            <tr class="info">
                <th colspan="6">网点基本信息</th>
            </tr>
            <tr>
                <td><label for="" style="min-width: 160px;width: 160px">网点名称<span class="colorRed">*</span>：</label></td>
                <td colspan="3"><input name="title" value="{:isset($data)?$data.title:''}" type="text" class="form-control" style="min-width: 200px;width: 200px"><span
                        class="colorRed">不允许英文状态下输入的单引号!</span></td>
                <td>所属系统名称</td>
                <td>南京家乐福</td>
            </tr>
            <tr>
                <td><label for="" style="min-width: 160px;width: 160px">网点编号：</label></td>
                <td colspan="5"><input name="sn" value="{:isset($data)?$data.sn:''}" type="text" class="form-control" style="min-width: 160px;width: 160px"><span
                        class="colorRed">(温馨说明：如不填写网点编号，系统将自动分配一个编号。)</span></td>
            </tr>
            <tr>
                <td>
                    <label for="cat" style="min-width: 160px;width: 160px">网点类型<span class="colorRed">*</span>：</label>
                </td>
                <td>
                    <select name="cat" value="{:isset($data)?$data.cat:''}" id="cat" style="min-width: 120px;width: 120px" class="form-control">
                        <option value="">请选择</option>
                        {if isset($cat)}
                        {volist name="cat" id="row"}
                        <option value="{$row.id}" {if isset($data)&&$row.id==$data.cat}selected{/if} >{$row.title}</option>
                        {/volist}
                        {/if}
                    </select>
                </td>
                <td>
                    <label for="" style="min-width: 160px;width: 160px">网点等级<span class="colorRed">*</span>：</label>
                </td>
                <td>
                    <select name="grade" value="{:isset($data)?$data.grade:''}" id="grade" style="min-width: 120px;width: 120px" class="form-control">
                        <option value="">请选择</option>
                        {if isset($grade)}
                        {volist name="grade" id="row"}
                        <option value="{$row.id}" {if isset($data)&&$row.id==$data.grade}selected{/if} >{$row.title}</option>
                        {/volist}
                        {/if}
                    </select>
                </td>
                <td><label for="em_num" style="min-width: 160px;width: 160px">雇员人数(个)</label></td>
                <td><input id="em_num" name="em_num" value="{:isset($data)?$data.em_num:''}" type="text" class="form-control"></td>
            </tr>
            <tr>
                <td><label for="area" style="min-width: 160px;width: 160px">店面面积(平方米):</label></td>
                <td><input id="area" name="area" value="{:isset($data)?$data.area:''}" type="text" class="form-control"></td>
                <td><label for="layers" style="min-width: 160px;width: 160px">店面层数:</label></td>
                <td><input id="layers" name="layers" value="{:isset($data)?$data.area:''}" type="text" class="form-control"></td>
                <td><label for="abbr" style="min-width: 160px;width: 160px">网点简称:</label></td>
                <td><input id="abbr" name="abbr" value="{:isset($data)?$data.abbr:''}" type="text" class="form-control"></td>
            </tr>
            <tr>
                <td><label for="shelf_num" style="min-width: 160px;width: 160px">同品类货架节数(各产品):</label></td>
                <td><input id="shelf_num" name="shelf_num" value="{:isset($data)?$data.shelf_num:''}" type="text" class="form-control"></td>
                <td><label for="cashiers" style="min-width: 160px;width: 160px">收银台数:</label></td>
                <td><input id="cashiers" name="cashiers" value="{:isset($data)?$data.cashiers:''}" type="text" class="form-control"></td>
                <td><label for="area_same_cat" style="min-width: 160px;width: 160px">同品类面积:</label></td>
                <td><input id="area_same_cat" name="area_same_cat" value="{:isset($data)?$data.area_same_cat:''}" type="text" class="form-control"></td>
            </tr>
            <tr>
                <td><label for="lanpushs_same_cat" style="min-width: 160px;width: 160px">同品类地堆数</label></td>
                <td><input id="lanpushs_same_cat" name="lanpushs_same_cat" value="{:isset($data)?$data.lanpushs_same_cat:''}" type="text" class="form-control"></td>
                <td><label for="frames_same_cat" style="min-width: 160px;width: 160px">同品类端架数:</label></td>
                <td><input id="frames_same_cat" name="frames_same_cat" value="{:isset($data)?$data.frames_same_cat:''}" type="text" class="form-control"></td>
                <td><label for="zipcode" style="min-width: 160px;width: 160px">邮编:</label></td>
                <td><input id="zipcode" name="zipcode" value="{:isset($data)?$data.zipcode:''}" type="text" class="form-control"></td>
            </tr>
            <tr>
                <td><label for="" style="min-width: 160px;width: 160px">是否重点网点</label></td>
                <td>
                    <label class="radio-inline">
                        <input type="radio" name="iskey" id="inlineRadio1" value="1" {if isset($data)&&$data.iskey==1}checked{/if}>是
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="iskey" id="inlineRadio2" value="0" {if !isset($data)||$data.iskey==0}checked{/if}>否
                    </label>
                </td>
                <td><label for="" style="min-width: 160px;width: 160px">是否直营网点:</label></td>
                <td>
                    <label class="radio-inline">
                        <input type="radio" name="direct" id="inlineRadio3" value="1" {if isset($data)&&$data.direct==1}checked{/if}>是
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="direct" id="inlineRadio4" value="0" {if !isset($data)||$data.direct==0}checked{/if}>否
                    </label>
                </td>
                <td><label for="" style="min-width: 160px;width: 160px">是否导购网点:</label></td>
                <td>
                    <label class="radio-inline">
                        <input type="radio" name="guide" id="inlineRadio5" value="1" {if isset($data)&&$data.guide==1}checked{/if}>是
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="guide" id="inlineRadio6" value="0" {if !isset($data)||$data.guide==0}checked{/if}>否
                    </label>
                </td>
            </tr>
            <tr>
                <td><label for="" style="min-width: 160px;width: 160px">一级渠道类型</label></td>
                <td>{$channel1}</td>
                <td><label for="" style="min-width: 160px;width: 160px">二级渠道类型</label></td>
                <td>{$channel2}</td>
                <td><label for="" style="min-width: 160px;width: 160px">开始合作日期</label></td>
                <td>
                    <div class="form-group">
                        <input name="cooptime" onclick="laydate()" value="{:isset($data)?date('Y-m-d',$data.cooptime):''}" type="text" id="start" placeholder="开始日期" class="form-control layer-date " style="height: 26px;display: inline-block;">
                    </div>
                </td>
            </tr>
            <tr>
                <td><label for="myarea" style="min-width: 160px;width: 160px">系统自编区域:</label></td>
                <td><input id="myarea" name="myarea" value="{:isset($data)?$data.myarea:''}" type="text" class="form-control"></td>
                <td><label for="mysn" style="min-width: 160px;width: 160px">系统自编店号:</label></td>
                <td><input id="mysn" name="mysn" value="{:isset($data)?$data.mysn:''}" type="text" class="form-control"></td>
                <td><label for="mypart" style="min-width: 160px;width: 160px">系统自编分仓:</label></td>
                <td><input id="mypart" name="mypart" value="{:isset($data)?$data.mypart:''}" type="text" class="form-control"></td>
            </tr>
            <tr>
                <td><label for="mypart_code" style="min-width: 160px;width: 160px">系统自编分仓代码:</label></td>
                <td><input id="mypart_code" name="mypart_code" value="{:isset($data)?$data.mypart_code:''}" type="text" class="form-control"></td>
                <td><label for="starttime" style="min-width: 160px;width: 160px">网店开店日期:</label></td>
                <td><input id="starttime" onclick="laydate()" name="starttime" value="{:isset($data)?date('Y-m-d',$data.starttime):''}" type="text" class="form-control"></td>
                <td><label for="" style="min-width: 160px;width: 160px">是否样板网点:</label></td>
                <td>
                    <label class="radio-inline">
                        <input type="radio" name="sample" id="inlineRadio7" value="1" {if isset($data)&&$data.sample==1}checked{/if}>是
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="sample" id="inlineRadio8" value="0" {if !isset($data)||$data.sample==0}checked{/if}>否
                    </label>
                </td>
            </tr>
            <tr>
                <td><label for="" style="min-width: 160px;width: 160px">是新进网点:</label></td>
                <td colspan="5">
                    <label class="radio-inline">
                        <input type="radio" name="isnew" id="inlineRadio71" value="1" {if isset($data)&&$data.isnew==1}checked{/if}>是
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="isnew" id="inlineRadio81" value="0" {if !isset($data)||$data.isnew==0}checked{/if}>否
                    </label>
                </td>
            </tr>
            <tr>
                <td>
                    <label for="" style="min-width: 160px;width: 160px">网点所属营销区域<span class="colorRed">*</span>：</label>
                </td>
                <td colspan="5">
                    <span>城市：</span>
                    <select name="zoning" id="zoning" style="min-width: 120px;width: 120px" class="form-control">
                        <option value="">请选择分区</option>
                        {volist name="zoning" id="row"}
                        <option value="{$row.id}" {if isset($data)&&$row.id==$data.zoning}selected{/if} >{$row.title}</option>
                        {/volist}
                    </select>
                    <select name="provice" id="provice" style="min-width: 120px;width: 120px" class="form-control">
                        <option value="">请选择省份</option>
                        {volist name="provice" id="row"}
                        <option value="{$row.id}" {if isset($data)&&$row.id==$data.provice}selected{/if} >{$row.title}</option>
                        {/volist}
                    </select>
                    <select name="city" id="city" style="min-width: 120px;width: 120px" class="form-control">
                        <option value="">请选择城市</option>
                        {volist name="city" id="row"}
                        <option value="{$row.id}" {if isset($data)&&$row.id==$data.city}selected{/if} >{$row.title}</option>
                        {/volist}
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <label for="" style="min-width: 160px;width: 160px">网点所属行政区域：</label>
                </td>
                <td colspan="5">
                    省份：
                    <select name="exec_provice" id="exec_provice" style="min-width: 120px;width: 120px" class="form-control">
                        <option value="">请选择省份</option>
                        {volist name="exec_provice" id="row"}
                        <option value="{$row.id}" {if isset($data)&&$row.id==$data.exec_provice}selected{/if} >{$row.title}</option>
                        {/volist}
                    </select>
                    城市：
                    <select name="exec_city" id="exec_city" style="min-width: 120px;width: 120px" class="form-control">
                        <option value="">请选择城市</option>
                        {volist name="exec_city" id="row"}
                        <option value="{$row.id}" {if isset($data)&&$row.id==$data.exec_city}selected{/if} >{$row.title}</option>
                        {/volist}
                    </select>
                    区县：
                    <select name="exec_county" id="exec_county" style="min-width: 120px;width: 120px" class="form-control">
                        <option value="">请选择区县</option>
                        {volist name="exec_county" id="row"}
                        <option value="{$row.id}" {if isset($data)&&$row.id==$data.exec_county}selected{/if} >{$row.title}</option>
                        {/volist}
                    </select>
                    <label for="detailAddress">详细地址<span class="colorRed">*</span></label>
                    <input id="detailAddress" name="detailAddress" value="{:isset($data)?$data.detailAddress:''}"  type="text" class="form-control">
                </td>
            </tr>
            <tr>
                <td rowspan="2" style="min-width: 160px;width: 160px">备注：</td>
                <td rowspan="2" colspan="5">
                    <textarea name="brief" id="brief" style="width: 60%;line-height: 80px; user-select:none">{:isset($data)?$data.brief:''}</textarea>(500)
                </td>
            </tr>
        </table>
        <div class="col-md-12 text-center" style="padding: 10px 0">
            <button class="btn-success btn" id="tijiao">确认并提交</button>
            <button class="btn-warning btn" id="cancelBack">返回</button>
        </div>

    </form>
</div>

<!-- 全局js -->
{include file="Public/footer"}

<script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
<script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>

<script>
    $(document).ready(function () {

            $('#zoning').on('change',function () {
                var id = $(this).val()
                $('#provice').load('{:url("select/provice")}?id='+id)
            })

            $('#provice').on('change',function () {
                var id = $(this).val()
                $('#city').load('{:url("select/city")}?id='+id)
            })
            $('#exec_provice').on('change',function () {
                var id = $(this).val()
                $('#exec_city').load('{:url("select/ecity")}?id='+id)
            })
            $('#exec_city').on('change',function () {
                var id = $(this).val()
                $('#exec_county').load('{:url("select/ecounty")}?id='+id)
            })



        $(".da_table").on("click", ".delThisTr", function () {

            $(this).parent().parent().remove();

        })

    })


</script>
<script>
    var cancelBack = document.getElementById('cancelBack')
        cancelBack.onclick = function () {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }

    /**
     * touxingren (首次从 URL 获取数据，显示 header，不显示按钮，忽略大小写，可清除)
     */
    $("#testNoBtn").bsSuggest({
        url: "{:url('jxsgl/provicejson')}",
        /*effectiveFields: ["userName", "shortAccount"],
         searchFields: [ "shortAccount"],*/
        effectiveFieldsAlias: {userName: "姓名"},
        ignorecase: true,
        showHeader: true,
        showBtn: false,     //不显示下拉按钮
        delayUntilKeyup: true, //获取数据的方式为 firstByUrl 时，延迟到有输入/获取到焦点时才请求数据
        idField: "id",
        keyField: "title",
        clearable: true
    }).on('onDataRequestSuccess', function (e, result) {
        console.log('onDataRequestSuccess: ', result);
    }).on('onSetSelectValue', function (e, keyword, data) {
        $(this).val('')
        var bool = false
        $('#renyuan .ren').each(function (idx, o) {
            if ($(this).data('id') == keyword.id) {
                bool = true;
            }
        })
        if (bool == false)
            $('#renyuan').append('<span class="ren" data-id="' + keyword.id + '">' + keyword.key + '<span class="close">×</span></span>')
        //console.log('onSetSelectValue: ', keyword, data);
    }).on('onUnsetSelectValue', function () {
        console.log("onUnsetSelectValue");
    });


    //提交
    $('#tijiao').on('click',function () {
        var form =  $('#add')
        var serial = form.not($('input[name=stuff]')).serialize()
        console.log(serial)
        $.ajax({
            'type':'post',
            'url':form.attr('action'),
            'data':serial,
            'dataType':'json',
            'success':function (data) {
                if(data.success){
                    swal({
                        title: data.msg,
                        type: "success"
                    },function(){
                        parent.layer.close(parent.layer.getFrameIndex(window.name))
                        });

                }else
                    swal({
                        title: data.msg,
                        type: "warning"
                    });
            }
        })
        return false
    })


</script>

</body>

</html>